home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / wnos5src.zip / CONFIG.C < prev    next >
Text File  |  1993-10-09  |  20KB  |  694 lines

  1. #include "hardware.h"   /***/
  2. /* Stuff heavily dependent on the configuration info in config.h */
  3.  
  4. #include <stdio.h>
  5. #include <dos.h>
  6. #include <ctype.h>
  7. #include <conio.h>
  8. #include "global.h"
  9. #include "mbuf.h"
  10. #include "proc.h"
  11. #include "cmdparse.h"
  12. #include "config.h"
  13. #include "daemon.h"
  14. #include "timer.h"
  15. #include "iface.h"
  16. #include "pktdrvr.h"
  17. #include "slip.h"
  18. #include "usock.h"
  19. #include "kiss.h"
  20. #ifdef ETHER
  21. #include "enet.h"
  22. #endif
  23. #include "ax25.h"
  24. #ifdef NETROM
  25. #include "netrom.h"
  26. #include "nr4.h"
  27. #endif
  28. #include "arp.h"
  29. #include "ip.h"
  30. #include "icmp.h"
  31. #include "tcp.h"
  32. #ifdef UDP
  33. #include "udp.h"
  34. #endif
  35. #include "commands.h"
  36. #ifdef ARCNET
  37. #include "arcnet.h"
  38. #endif
  39. #include "event.h"
  40.  
  41. #define RDATE
  42.  
  43. #ifdef RDATE
  44. #define DIFFTIME 2208988800L
  45.  
  46. static int dordate __ARGS((int argc,char **argv,void *p));
  47. #endif
  48. static int dostart __ARGS((int argc,char **argv,void *p));
  49. static int dostop __ARGS((int argc,char **argv,void *p));
  50. static int dowrite __ARGS((int argc,char **argv,void *p));
  51.  
  52. struct mbuf *Hopper;
  53. unsigned Nsessions = NSESSIONS;
  54.  
  55. /* Transport protocols atop IP */
  56. struct iplink Iplink[] = {
  57.     TCP_PTCL,       tcp_input,
  58. #ifdef UDP
  59.     UDP_PTCL,       udp_input,
  60. #endif
  61.     ICMP_PTCL,      icmp_input,
  62. #if (defined (AX25) && defined (AXIP))
  63.     AX25_PTCL,      axip_input,
  64. #endif
  65.     IP_PTCL,        ipip_recv,
  66.     0,              0
  67. };
  68.  
  69. /* Transport protocols atop ICMP */
  70. struct icmplink Icmplink[] = {
  71.     TCP_PTCL,       tcp_icmp,
  72.     0,              0
  73. };
  74.  
  75. /* ARP protocol linkages */
  76. struct arp_type Arp_type[NHWTYPES] = {
  77. #ifdef  NETROM
  78.     AXALEN, 0, 0, 0, NULLCHAR, pax25, setcall,      /* ARP_NETROM */
  79. #else
  80.     0, 0, 0, 0, NULLCHAR,0,0,
  81. #endif
  82.  
  83. #ifdef  ETHER
  84.     EADDR_LEN,IP_TYPE,ARP_TYPE,1,Ether_bdcst,pether,gether, /* ARP_ETHER */
  85. #else
  86.     0, 0, 0, 0, NULLCHAR,0,0,
  87. #endif
  88.  
  89.     0, 0, 0, 0, NULLCHAR,0,0,               /* ARP_EETHER */
  90.  
  91. #ifdef  AX25
  92.     AXALEN, PID_IP, PID_ARP, PENDTIME, Ax25multi[0], pax25, setcall,
  93. #else
  94.     0, 0, 0, 0, NULLCHAR,0,0,               /* ARP_AX25 */
  95. #endif
  96.  
  97.     0, 0, 0, 0, NULLCHAR,0,0,               /* ARP_PRONET */
  98.  
  99.     0, 0, 0, 0, NULLCHAR,0,0,               /* ARP_CHAOS */
  100.  
  101.     0, 0, 0, 0, NULLCHAR,0,0,               /* ARP_IEEE802 */
  102.  
  103. #ifdef  ARCNET
  104.     AADDR_LEN, ARC_IP, ARC_ARP, 1, ARC_bdcst, parc, garc, /* ARP_ARCNET */
  105. #else
  106.     0, 0, 0, 0, NULLCHAR,0,0,
  107. #endif
  108.  
  109. };
  110.  
  111. /* daemons to be run at startup time */
  112. struct daemon Daemons[] = {
  113.     "timer",    2048,   timerproc,
  114.     "network",  2048,   network,
  115.     "event",    1280,   event,
  116.     "killer",   512,    killer,
  117.     "status",   512,    statusline,
  118.     "keyboard", 512,    keyboard,
  119.     NULLCHAR,   0,      NULLVFP
  120. };
  121.  
  122. struct iftype Iftypes[] = {
  123.     /* This entry must be first, since Loopback refers to it */
  124.     "None", 0, 0, 0, 0,     CL_NONE, 0,
  125.  
  126. #ifdef  AX25
  127.     "AX25",ax_send,ax_output,pax25,setcall,CL_AX25,AXALEN,
  128. #endif
  129.  
  130. #ifdef  SLIP
  131.     "SLIP",slip_send,0,0,0,CL_NONE,0,
  132. #endif
  133.  
  134. #ifdef  ETHER
  135.     /* Note: NULL is specified for the scan function even though
  136.      * gether() exists because the packet drivers don't support
  137.      * address setting.
  138.      */
  139.     "Ethernet",enet_send,enet_output,pether,0,CL_ETHERNET,EADDR_LEN,
  140. #endif
  141.  
  142. #ifdef  NETROM
  143.     "NETROM",nr_send,0,pax25,setcall,CL_NETROM,AXALEN,
  144. #endif
  145.  
  146. #ifdef  SLFP
  147.     "SLFP",pk_send,NULL,NULL,NULL,CL_NONE,0,
  148. #endif
  149.     NULLCHAR
  150. };
  151.  
  152. /* Command lookup and branch tables */
  153. struct cmds Cmds[] = {
  154.     /* The "go" command must be first */
  155.     "",             go,             0, 0, NULLCHAR,
  156.     "!",            doshell,        0, 0, NULLCHAR,
  157.     "abort",        doabort,        0, 0, NULLCHAR,
  158. #if     (defined(AX25) || defined(ETHER))
  159.     "arp",          doarp,          0, 0, NULLCHAR,
  160. #endif
  161. #ifdef  ASY
  162.     "asystat",      doasystat,      0, 0, NULLCHAR,
  163. #endif
  164.     "attach",       doattach,       0, 2, "attach <hardware> <hw specific options>",
  165.     "attended",     doattended,     0, 0, NULLCHAR,
  166.     "attribute",doattribute,0, 2, "attribute <color|mono>",
  167. #ifdef  AX25
  168.     "ax25",         doax25,         0, 0, NULLCHAR,
  169. #endif
  170. #ifdef  MAILBOX
  171.     "bbs",          dobbs,          1024, 0, NULLCHAR,
  172. #endif
  173.     "bell",         dobell,         0, 0, NULLCHAR,
  174. /* This one is out of alpabetical order to allow abbreviation to "c" */
  175. #ifdef  AX25
  176.     "connect",  doconnect,          1280, 2, "connect [<iface>] <call>",
  177. #endif
  178.     "chat",         dochat,         1024, 2, "chat <host>",
  179.     "cd",           docd,           0, 0, NULLCHAR,
  180.     "close",        doclose,        0, 0, NULLCHAR,
  181. #ifdef MODEM
  182.     "dial",         dodial,         1024, 2, "dial <iface> [<timeout> <upfile> <downfile>] | 0",
  183. #endif
  184.     "dir",          dodir,          1024, 0, NULLCHAR, /* note sequence */
  185.     "delete",       dodelete,       0, 2, "delete <file>",
  186.     "detach",       dodetach,       0, 2, "detach <iface>",
  187.     "domain",       dodomain,       0, 0, NULLCHAR,
  188. #ifdef  DRSI
  189.     "drsistat",     dodrstat,       0, 0, NULLCHAR,
  190. #endif
  191. #ifdef  EAGLE
  192.     "eaglestat",    doegstat,       0, 0, NULLCHAR,
  193. #endif
  194.     "echo",         doecho,         0, 0, NULLCHAR,
  195.     "eol",          doeol,          0, 0, NULLCHAR,
  196.     "escape",       doescape,       0, 0, NULLCHAR,
  197. #ifdef  PC_EC
  198.     "etherstat",    doetherstat,    0, 0, NULLCHAR,
  199. #endif
  200.     "event",        doevent,        0, 0, NULLCHAR,                /*DK5DC*/
  201.     "exit",         doexit,         0, 0, NULLCHAR,
  202.     "finger",       dofinger,       1024, 2, "finger <name|[@<host>]>",
  203.     "ftp",          doftp,          1536, 2, "ftp <host>",
  204. #ifdef HAPN
  205.     "hapnstat",     dohapnstat,     0, 0, NULLCHAR,
  206. #endif
  207.     "help",         dohelp,         0, 0, NULLCHAR,
  208.     "hostname",     dohostname,     0, 0, NULLCHAR,
  209. #ifdef  HS
  210.     "hs",           dohs,           0, 0, NULLCHAR,
  211. #endif
  212.     "icmp",         doicmp,         0, 0, NULLCHAR,
  213.     "ifconfig",     doifconfig,     0, 0, NULLCHAR,
  214.     "ip",           doip,           0, 0, NULLCHAR,
  215.     "kick",         dokick,         0, 0, NULLCHAR,
  216.     "log",          dolog,          0, 0, NULLCHAR,
  217. #ifdef LZW
  218.     "lzw",          dolzw,          0, 2, "lzw <bits|mode>",
  219. #endif
  220.     "mail",         dobmail,        0, 0, NULLCHAR,
  221. #ifdef  MAILBOX
  222.     "mbox",         dombox,         0, 0, NULLCHAR,
  223. #endif
  224.     "mem",          domem,          0, 0, NULLCHAR,
  225.     "mkdir",        domkd,          0, 2, "mkdir <dir>",
  226. #ifdef  AX25
  227.     "mode",         domode,         0, 2, "mode <host> [<datagram|vc|ipcam>]",
  228. #endif
  229.     "more",         domore,         1024, 2, "more <file>",
  230.     "motd",         domotd,         0, 0, NULLCHAR,
  231. #ifdef  NETROM
  232.     "netrom",       donetrom,       0, 0, NULLCHAR,
  233. #endif
  234. #ifdef  NNTP
  235.     "nntp",         donntp,         0, 0, NULLCHAR,
  236. #endif
  237. #ifdef  NRS
  238.     "nrstat",       donrstat,       0, 0, NULLCHAR,
  239. #endif
  240.     "param",        doparam,        0, 2, "param <iface>",
  241.     "ping",         doping,         1024, 2, "ping <host> <length> <interval> <incflag>",
  242. #ifdef POP
  243.     "pop",          dopop,          0, 0, NULLCHAR,
  244. #endif
  245.     "ps",           ps,             0, 0, NULLCHAR,
  246.     "pwd",          docd,           0, 0, NULLCHAR,
  247. #ifdef RDATE
  248.     "rdate",        dordate,        768, 2, "rdate <host>",
  249. #endif    
  250.     "record",       dorecord,       0, 0, NULLCHAR,
  251. #ifdef UDP
  252.     "remote",       doremote,       0, 3, "remote [-p port] [-k key] [-a kickaddr] <host> exit|reset|kick",
  253. #endif
  254.     "rename",       dorename,       0, 3, "rename <oldfile> <newfile>",
  255.     "reset",        doreset,        0, 0, NULLCHAR,
  256.     "resetping",    doresetping,    0, 2, "resetping <target>",
  257.     "rmdir",        dormd,          0, 2, "rmdir <dir>",
  258.     "route",        doroute,        0, 0, NULLCHAR,
  259.     "session",      dosession,      0, 0, NULLCHAR,
  260.     "save",         dosavefile,     0, 0, NULLCHAR,
  261. #ifdef  SCC
  262.     "sccstat",      dosccstat,      0, 0, NULLCHAR,
  263. #endif
  264.     "setping",      dosetping,      0, 0, NULLCHAR,
  265.     "shell",        doshell,        0, 0, NULLCHAR,
  266.     "smtp",         dosmtp,         0, 0, NULLCHAR,
  267.     "socket",       dosock,         0, 0, NULLCHAR,
  268.     "source",       dosource,       0, 2, "source <file>",
  269. #ifdef  SERVERS
  270.     "start",        dostart,        0, 0, NULLCHAR,
  271. #endif
  272.     "status",       dostatus,       0, 0, NULLCHAR,
  273. #ifdef  SERVERS
  274.     "stop",         dostop,         0, 0, NULLCHAR,
  275. #endif
  276.     "swap",         doswap,         0, 0, NULLCHAR,
  277. #ifdef MAILBOX
  278.     "sysop",        dosysopset,     0, 2, "<number>",
  279. #endif
  280.     "tcp",          dotcp,          0, 0, NULLCHAR,
  281.     "tail",         dotail,         0, 2, "tail <file>",
  282.     "telnet",       dotelnet,       1024, 2, "telnet <host>",
  283. /* #ifdef ASY  */
  284. #ifdef MODEM
  285.     "tip",          dotip,          1024, 2, "tip <iface>",
  286. #endif
  287. #ifdef  TRACE
  288.     "trace",        dotrace,        0, 0, NULLCHAR,
  289. #endif
  290. #ifdef UDP
  291.     "udp",          doudp,          0, 0, NULLCHAR,
  292. #endif
  293.     "upload",       doupload,       0, 0, NULLCHAR,
  294.     "wrap",         dowrap,         0, 0, NULLCHAR,
  295.     "write",        dowrite,        0, 2, "write <socket> <msg>",
  296.     "?",            dohelp,         0, 0, NULLCHAR,
  297.     NULLCHAR,       NULLFP,         0, 0, "Unknown command. Type ? for help.",
  298. };
  299.  
  300. /* Functions to be called on each clock tick */
  301. void
  302. (*Cfunc[])(void) = {
  303.     pctick,         /* Call PC-specific stuff to keep time */
  304.     kbint,          /* Necessary because there's no hardware keyboard interrupt */
  305.     refiq,          /* Replenish interrupt pool */
  306. #ifdef  ASY
  307.     asytimer,
  308. #endif
  309. #ifdef  SCC
  310.     scctimer,
  311. #endif
  312.     0,
  313. };
  314.  
  315. /* Packet tracing stuff */
  316. #ifdef  TRACE
  317. #include "trace.h"
  318.  
  319. /* Protocol tracing function pointers. Matches list of class definitions
  320.  * in pktdrvr.h.
  321.  */
  322. struct trace Tracef[] = {
  323.     NULLFP,                 ip_dump,                /* CL_NONE */
  324. #ifdef  ETHER
  325.     ether_forus,    ether_dump,             /* CL_ETHERNET */
  326. #else
  327.     NULLFP,         NULLVFP,
  328. #endif
  329.     NULLFP,                 NULLVFP,                /* CL_PRONET_10 */
  330.     NULLFP,                 NULLVFP,                /* CL_IEEE8025 */
  331.     NULLFP,                 NULLVFP,                /* CL_OMNINET */
  332.     NULLFP,                 NULLVFP,                /* CL_APPLETALK */
  333.     NULLFP,                 ip_dump,                /* CL_SERIAL_LINE */
  334.     NULLFP,                 NULLVFP,                /* CL_STARLAN */
  335. #ifdef  ARCNET
  336.     arc_forus,              arc_dump,               /* CL_ARCNET */
  337. #else
  338.     NULLFP,                 NULLVFP,
  339. #endif
  340. #ifdef  AX25
  341.     ax_forus,               ax25_dump,              /* CL_AX25 */
  342. #else
  343.     NULLFP,                 NULLVFP,
  344. #endif
  345. #ifdef  KISS
  346.     ki_forus,               ki_dump,                /* CL_KISS */
  347. #else
  348.     NULLFP,                 NULLVFP,
  349. #endif
  350.     NULLFP,                 NULLVFP,                /* CL_IEEE8023 */
  351.     NULLFP,                 NULLVFP,                /* CL_FDDI */
  352.     NULLFP,                 NULLVFP,                /* CL_INTERNET_X25 */
  353.     NULLFP,                 NULLVFP,                /* CL_LANSTAR */
  354.     NULLFP,                 ip_dump,                /* CL_SLFP */
  355. #ifdef  NETROM
  356.     NULLFP,                 ip_dump,        /* CL_NETROM */
  357. #else
  358.     NULLFP,                 NULLVFP,
  359. #endif
  360. };
  361. #else   /* TRACE */
  362. /* Stub for packet dump function */
  363. void
  364. dump(struct iface *iface,int direction,unsigned type,struct mbuf *bp)
  365. {
  366. }
  367. #endif  /* TRACE */
  368.  
  369. /* Stub for routing timeout when RIP is not configured -- just remove entry */
  370. void
  371. rt_timeout(void *s)
  372. {
  373.     struct route *stale = (struct route *)s;
  374.  
  375.     rt_drop(stale->target,stale->bits);
  376. }
  377.  
  378. #ifdef  SERVERS
  379.  
  380. /* "start" and "stop" subcommands */
  381. static int
  382. dostart(int argc,char **argv,void *p)
  383. {
  384.     struct cmds Startcmds[] = {
  385. #if     defined(AX25) && defined(MAILBOX)
  386.         "ax25",         ax25start,      256, 0, NULLCHAR,
  387. #endif
  388.         "chat",         ttyl1,          256, 0, NULLCHAR,
  389. #ifdef CONVERS
  390.         "convers",      conv1,          256, 0, NULLCHAR,
  391. #endif
  392.         "discard",      dis1,           256, 0, NULLCHAR,
  393. #ifdef DNS
  394.         "domain",       dom1,           768, 0, NULLCHAR,
  395. #endif
  396.         "echo",         echo1,          256, 0, NULLCHAR,
  397.         "finger",       fin1,           256, 0, NULLCHAR,
  398.         "ftp",          ftp1,           256, 0, NULLCHAR,
  399. #if     defined(NETROM) && defined(MAILBOX)
  400.         "netrom",       nr4start,       256, 0, NULLCHAR,
  401. #endif
  402. #ifdef  NNTP
  403.         "nntp",     nntp1,              256, 0, NULLCHAR,
  404. #endif
  405. #ifdef POP
  406.         "pop",          pop1,           256, 0, NULLCHAR,
  407. #endif
  408.         "smtp",         smtp1,          256, 0, NULLCHAR,
  409. #ifdef MAILBOX
  410.         "telnet",       telnet1,        256, 0, NULLCHAR,
  411. #ifdef MODEM
  412.         "tip",          tip1,           512, 2, "start tip <iface>",
  413. #endif
  414. #endif
  415.         "ttylink",      ttyl1,          256, 0, NULLCHAR,
  416. #ifdef UDP
  417.         "remote",       rem1,           1768, 0, NULLCHAR,
  418. #endif
  419. #if (defined(LZW) && defined(CONVERS))
  420.         "xconvers", xconv1,             256, 0, NULLCHAR,
  421. #endif
  422.         NULLCHAR,
  423.     };
  424.     return subcmd(Startcmds,argc,argv,p);
  425. }
  426.  
  427. static int
  428. dostop(int argc,char **argv,void *p)
  429. {
  430.     struct cmds Stopcmds[] = {
  431. #if     defined(AX25) && defined(MAILBOX)
  432.         "ax25",         ax25stop,       0, 0, NULLCHAR,
  433. #endif
  434.         "chat",         ttyl0,          0, 0, NULLCHAR,
  435. #ifdef CONVERS
  436.         "convers",      conv0,          0, 0, NULLCHAR,
  437. #endif
  438.         "discard",      dis0,           0, 0, NULLCHAR,
  439. #ifdef DNS
  440.         "domain",       dom0,           0, 0, NULLCHAR,
  441. #endif
  442.         "echo",         echo0,          0, 0, NULLCHAR,
  443.         "finger",       fin0,           0, 0, NULLCHAR,
  444.         "ftp",          ftp0,           0, 0, NULLCHAR,
  445. #if     defined(NETROM) && defined(MAILBOX)
  446.         "netrom",       nr4stop,        0, 0, NULLCHAR,
  447. #endif
  448. #ifdef NNTP
  449.         "nntp",         nntp0,          0, 0, NULLCHAR,
  450. #endif
  451. #ifdef POP
  452.         "pop",          pop0,           0, 0, NULLCHAR,
  453. #endif
  454.         "smtp",         smtp0,          0, 0, NULLCHAR,
  455. #ifdef  MAILBOX
  456.         "telnet",       telnet0,        0, 0, NULLCHAR,
  457. #ifdef MODEM
  458.         "tip",          tip0,           0, 2, "stop tip <iface>",
  459. #endif
  460. #endif
  461.         "ttylink",      ttyl0,          0, 0, NULLCHAR,
  462. #ifdef UDP
  463.         "remote",       rem0,           0, 0, NULLCHAR,
  464. #endif
  465. #if defined(LZW) && defined(CONVERS)
  466.         "xconvers", xconv0,             0, 0, NULLCHAR,
  467. #endif
  468.         NULLCHAR,
  469.     };
  470.     return subcmd(Stopcmds,argc,argv,p);
  471. }
  472. #endif  /* SERVERS */
  473.  
  474. /* Various configuration-dependent functions */
  475. /* Process packets in the Hopper */
  476. static void
  477. network(int i,void *v1,void *v2)
  478. {
  479.     struct mbuf *bp;
  480.     struct phdr phdr;
  481.     int i_state;
  482.  
  483.     for(;;) {
  484.         refiq();        /* Replenish interrupt buffer pool */
  485.  
  486.         i_state = dirps();
  487.  
  488.         while(Hopper == NULLBUF) {
  489.             pwait(&Hopper);
  490.         }
  491.         restore(i_state);
  492.  
  493.         /* Process the input packet */
  494.         bp = dequeue(&Hopper);
  495.  
  496.         pullup(&bp,(char *)&phdr,sizeof(struct phdr));
  497.         dump(phdr.iface,IF_TRACE_IN,phdr.type,bp);
  498.  
  499.         switch(phdr.type){
  500. #ifdef  KISS
  501.         case CL_KISS:
  502.             kiss_recv(phdr.iface,bp);
  503.             break;
  504. #endif
  505. #ifdef  AX25
  506.         case CL_AX25:
  507.             ax_recv(phdr.iface,bp);
  508.             break;
  509. #endif
  510. #ifdef  ETHER
  511.         case CL_ETHERNET:
  512.             eproc(phdr.iface,bp);
  513.             break;
  514. #endif
  515. #ifdef ARCNET
  516.         case CL_ARCNET:
  517.             aproc(phdr.iface,bp);
  518.             break;
  519. #endif
  520.         /* These types have no link layer protocol at the point when they're
  521.          * put in the hopper, so they can be handed directly to IP. The
  522.          * separate types are just for user convenience when running the
  523.          * "iface" command.
  524.          */
  525.         case CL_NONE:
  526.         case CL_SERIAL_LINE:
  527.         case CL_SLFP:
  528.             ip_route(phdr.iface,phdr.iface,bp,0);
  529.             break;
  530.         default:
  531.             free_p(bp);
  532.             break;
  533.         }
  534.         /* Let everything else run - this keeps the system from wedging
  535.          * when we're hit by a big burst of packets
  536.          */
  537.         pwait(NULL);
  538.     }
  539. }
  540.  
  541. static int
  542. dowrite(int argc,char **argv,void *p)
  543. {
  544.     char msg[256];
  545.     int i, sock[128], count = (argc < Nusock - 1) ? argc : Nusock - 1;
  546.  
  547.     /* get socket args */
  548.     for (i = 1; i < count; i++) {
  549.         if((sock[i] = atoi(argv[i])) == 0) {
  550.             break;
  551.         }
  552.     }
  553.     count = i;
  554.     *msg = '\0';
  555.  
  556.     /* collect rest of args as message */
  557.     for (; i < argc; i++) {
  558.         strcat(msg,argv[i]);
  559.         strcat(msg," ");
  560.     }
  561.     /* output to all sockets */
  562.     for (i = 1; i < count; i++)     {
  563.         usprintf(sock[i],"\n*** message from %s:\n%s\n",Hostname,msg);
  564.         usflush(sock[i]);
  565.     }
  566.     return 0;
  567. }
  568.  
  569. /* Attach an interface
  570.  * Syntax: attach <hw type> <I/O address> <vector> <mode> <label> <bufsize> [<speed>]
  571.  */
  572. static int
  573. doattach(int argc,char **argv,void *p)
  574. {
  575.   /* List of supported hardware devices */
  576.   struct cmds Attab[] = {
  577. #ifdef  PC_EC
  578.     /* 3-Com Ethernet interface */
  579.     "3c500", ec_attach, 0, 7,
  580.     "attach 3c500 <address> <vector> arpa <label> <bufsize> <mtu>",
  581. #endif
  582. #ifdef  ASY
  583.     /* Ordinary PC asynchronous adaptor */
  584.     "asy", asy_attach, 0, 8,
  585.     "attach asy <address> <vector> slip|ax25|nrs <label> <bufsize> <mtu> <speed> [c|r]",
  586. #endif  /* ASY */
  587. #if defined(KISS) && (defined(ASY) || defined(SCC))
  588.     /* Multi-port KISS interface piggy-backing on ASY interface. */
  589.     "kiss", kiss_attach, 0, 4,
  590.     "attach kiss <asy_iface_label> <port> <label> [<mtu>]",
  591. #endif  /* KISS */
  592. #ifdef  PC100
  593.     /* PACCOMM PC-100 8530 HDLC adaptor */
  594.     "pc100", pc_attach, 0, 8,
  595.     "attach pc100 <address> <vector> ax25 <label> <bufsize> <mtu> <speed>",
  596. #endif
  597. #ifdef  DRSI
  598.     /* DRSI PCPA card in low speed mode */
  599.     "drsi", dr_attach, 0, 8,
  600.     "attach drsi <address> <vector> ax25 <label> <bufsize> <mtu> <speed_A> [<speed_B>]",
  601. #endif
  602. #ifdef  EAGLE
  603.     /* EAGLE RS-232C 8530 HDLC adaptor */
  604.     "eagle", eg_attach, 0, 8,
  605.     "attach eagle <address> <vector> ax25 <label> <bufsize> <mtu> <speed>",
  606. #endif
  607. #ifdef  HAPN
  608.     /* Hamilton Area Packet Radio (HAPN) 8273 HDLC adaptor */
  609.     "hapn", hapn_attach, 0, 8,
  610.     "attach hapn <address> <vector> ax25 <label> <bufsize> <mtu> csma|full",
  611. #endif
  612. #ifdef NETROM
  613.     /* fake netrom interface */
  614.     "netrom", nr_attach, 0, 1,
  615.     "attach netrom",
  616. #endif
  617. #ifdef  PACKET
  618.     /* FTP Software's packet driver spec */
  619.     "packet", pk_attach, 0, 4,
  620.     "attach packet <int#> <label> <bufsize> <mtu>",
  621. #endif
  622. #ifdef  HS
  623.     /* Special high speed driver for DRSI PCPA or Eagle cards */
  624.     "hs", hs_attach, 0, 7,
  625.     "attach hs <address> <vector> ax25 <label> <bufsize> <mtu>"
  626.     " <txdelay> <persistence> [<rev_sense>]",
  627. #endif
  628. #ifdef SCC
  629.     "scc", scc_attach, 0, 7,
  630.     "attach scc <devices> init <address> <spacing> <Aoff> <Boff> <Dataoff>\n"
  631.     "   <intack> <vector> [p|r]<clock> [hdwe] [param]\n"
  632.     "attach scc <channel> slip|ax25|nrs|kiss <label> <mtu> <speed> <bufsize>",
  633.   #endif
  634. #if (defined (AX25) && defined (AXIP))
  635.     "axip", axip_attach, 0, 3,
  636.     "attach axip <label> <mtu> <remote_host>",
  637. #endif
  638. #ifdef  VANESSA
  639.     "vanessa", van_attach, 0, 3,
  640.     "attach vanessa <label> <port> [<mtu>]",
  641. #endif
  642.     NULLCHAR,
  643.   };
  644.   return subcmd(Attab,argc,argv,p);
  645. }
  646.  
  647. #ifdef RDATE
  648. static int
  649. dordate(int argc,char **argv,void *p)
  650. {
  651.     struct sockaddr_in sock;
  652.     int s;
  653.     struct mbuf *bp;
  654.     time_t rtime;
  655.  
  656.     if((sock.sin_addr.s_addr = resolve(argv[1])) == 0) {
  657.         tprintf(Badhost,argv[1]);
  658.         return 1;
  659.     }
  660.     sock.sin_family = AF_INET;
  661.     sock.sin_port = IPPORT_TIME;
  662.  
  663.     /* Open connection to time server */
  664.     if((s = socket(AF_INET,SOCK_STREAM,0)) == -1) {
  665.         tputs(Nosocket);
  666.         return 1;
  667.     }
  668.     sockmode(s,SOCK_BINARY);
  669.  
  670.     /* Connect to time server */
  671.     if(connect(s,(char *)&sock,sizeof(sock)) == -1) {
  672.         close_s(s);
  673.         return 1;
  674.     }
  675.     /* Get time info sent by server */
  676.     recv_mbuf(s,&bp,0,NULLCHAR,(int *)0);
  677.     
  678.     /* Convert 1900 start date to 1970 start date */
  679.     rtime = (time_t)pull32(&bp) - DIFFTIME;
  680.     
  681.     /* Set the system time */
  682.     stime(&rtime);
  683.     
  684.     log(s,9983,"RDAT %s: %s\n",argv[1],ctime(&rtime));
  685.     
  686.     free_q(&bp);
  687.     close_s(s);
  688.     return 0;
  689. #endif
  690.  
  691.  
  692.  
  693.